package com.iraeta.dao.main.sys;

import com.iraeta.entity.main.User;
import com.iraeta.entity.main.UserRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserDao {
    int insert(User record);

    int updateByPrimaryKey(User record);

    int deleteByPrimaryKey(Integer id);

    User selectByPrimaryKey(Integer id);

    User selectByWxuid(@Param("wxuid") String wxuid);

    User selectByPhone(@Param("phone") String phone);

    User selectUserByUserName(@Param("userName") String userName, @Param("pwd") String pwd);

    List<User> selectUserByName(@Param("name") String name);
    List<User> listOrgUserByName(@Param("orgId") Integer orgId, @Param("name") String name);
    List<User> selectUserByPermissionId(@Param("permissionid")  Integer permissionId);

    /*userRole  user set role*/
    int insertUserRole(UserRole record);
    UserRole selectByUserRole(@Param("userId") Integer userId, @Param("roleId") Integer roleId);
    void deleteUserRoleIdStr(@Param("userId") Integer userId, @Param("userRoleIdStr") String userRoleIdStr); //删除userId的 不在userRoleIdStr中的数据

    /*userRole role set user*/
    //role 选择用户用
    List<User> selectUserByRoleId(@Param("roleId") Integer roleId);

    /*user permission*/
    List<Integer> selectUserPermissions(@Param("userId") Integer userId);
}